<?php

namespace app\index\controller;

use app\common\model\ToolModel;
use app\common\YujisoController;
use app\index\service\WarehousecountryService;

class Warehousecountry extends YujisoController
{
    public function __construct()
    {
        parent::__construct();
    }

    //国家仓入库详情 修改
    public function inputDetail()
    {
        if ($this->request->isPost()) {

        } else {
            //详情
            exitJson(WarehousecountryService::detail($this->param));
        }
    }
    //确定入库和编辑
    public function  inputEdit(){
        $param = $this->request->post();
        if ($this->request->isPost()) {
            $list = json_decode($param['list'], true);
            unset($param['list']);
            $param['list'] = $list;
            if ($this->param['id']) {
                //编辑 确定入库
                exitJson(WarehousecountryService::warehouseCountryIn($param));
            }
        }
    }
    //国家仓入库列表
    public function input()
    {
        exitJson(WarehousecountryService::getList($this->param));
    }

    //国家仓成本列表
    public function cost()
    {
        exitJson(WarehousecountryService::getCostList($this->param));
    }

    //国家仓成本详情
    public function costDetail()
    {
        exitJson(WarehousecountryService::costDetail($this->param));
    }

    //国家仓库存列表
    public function stock()
    {
        exitJson(WarehousecountryService::getStockList($this->param));
    }

    //国家仓预占列表
    public function advance()
    {
        exitJson(WarehousecountryService::getAdvanceList($this->param));
    }

    //出库列表
    public function out()
    {
        exitJson(WarehousecountryService::getOutList($this->param));
    }

    public function outDetail()
    {
        exitJson(WarehousecountryService::outDetail($this->param));
    }
    //出库确认
    public function outStockConfirm(){
        exitJson(WarehousecountryService::outStockConfirmDo($this->param));
    }

    //国家仓上传明细
    public function upload()
    {
        $param = [];
        $param['id'] = $this->param['id'];
        $param['title'] = ['sku', '入库数量'];//必须校验头部
        $param['actionAsync'] = '\app\index\service\WarehousecountryService::uploadHandle';//上传数据的数据回调到service层处理
        $res = \app\common\service\ExcelLibraryService::read($param);
        exitJson($res);
    }
}